package io.renren.modules.node.service.impl;

import io.renren.modules.node.dao.BizNodeMapper;
import io.renren.modules.node.entity.BizNode;
import io.renren.modules.node.service.NodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class NodeServiceImpl implements NodeService {

    @Autowired
    BizNodeMapper bizNodeMapper;
    @Override
    public Integer addNode(String nodeName) {
        String code = UUID.randomUUID().toString();
        BizNode bizNode = new BizNode();
        bizNode.setName(nodeName);
        bizNode.setCode(code);
        bizNode.setType(new Short("1"));
        bizNode.setParentCode("0");

        int result = bizNodeMapper.insertSelective(bizNode);
        return result;
    }

    @Override
    public Integer addNode(String parentCode, BizNode child) {

        return null;
    }
}
